package com.csun.cmny.provider.device.phone.entity;

import com.csun.cmny.util.RedisKeyUtil;
import io.netty.channel.Channel;
import io.netty.util.AttributeKey;

import java.util.concurrent.ConcurrentHashMap;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-02-19 13:42
 * @Description: phone constant
 */
public class PhoneConstant {

    public static final byte[] PHONE_RESPONSE = { (byte) 0xad, (byte) 0x99, (byte) 0x0d, (byte) 0x0a };

    public static ConcurrentHashMap<String, Channel> PHONE_CHANNEL_MAP = new ConcurrentHashMap<>();

    public static final AttributeKey<PhoneDataEntity> PHONE_CHANNEL_KEY = AttributeKey.valueOf("cmny:device:zn:phone");

    /**
     * 防区绑定 - 自定义
     */
    public static final int PHONE_ZONE_BIND_TYPE_CUSTOM = 0;

    /**
     * 防区绑定 - 老人
     */
    public static final int PHONE_ZONE_BIND_TYPE_OLDMAN = 1;

    /**
     * 防区绑定 - 床位
     */
    public static final int PHONE_ZONE_BIND_TYPE_BED = 2;

    /**
     * 防区绑定 - 房间
     */
    public static final int PHONE_ZONE_BIND_TYPE_ROOM = 3;

    /**
     * 布防
     */
    public static int ARMING_ON = 1;

    /**
     * 撤防
     */
    public static int ARMING_OFF = 0;

    /**
     * 请求头
     */
    public static final byte PHONE_HEAD = (byte) 0xad;

    /**
     * 回复
     */
    public static final byte PHONE_HEAD_REQ = (byte) 0xcc;

    /**
     * 结束位-1
     */
    public static final byte PHONE_END_1 = 0x0d;

    /**
     * 结束位-2
     */
    public static final byte PHONE_END_2 = 0x0a;

    /**
     * 数据包应答
     */
    public static final byte PHONE_DATA_TYPE_RESP = (byte) 0x99;

    /**
     * 设备登录(由设备端发送)
     */
    public static final byte PHONE_DATA_TYPE_LOGIN_REQ = 0x01;

    /**
     * 设备事件
     */
    public static final byte PHONE_DATA_TYPE_EVENT = 0x02;

    /**
     * 登录成功(由服务端发送)
     */
    public static final byte PHONE_DATA_TYPE_LOGIN_ACK = 0x06;

    /**
     * 设备心跳
     */
    public static final byte PHONE_DATA_TYPE_HEART = 0x07;

    /**
     * 操作指令
     */
    public static final byte PHONE_DATA_TYPE_CMD_REQ = 0x11;

    /**
     * 指令结果
     */
    public static final byte PHONE_DATA_TYPE_CMD_ACK = 0x0a;

    /**
     * 撤防
     */
    public static final short PHONE_EVENT_DISARM = 0x1401;

    /**
     * 布防
     */
    public static final short PHONE_EVENT_ARMING = 0x3401;


    /**
     * 遥控撤防
     */
    public static final short PHONE_EVENT_DISARM_REMOTE = 0x1407;

    /**
     * 遥控布防
     */
    public static final short PHONE_EVENT_ARMING_REMOTE = 0x3407;

    /**
     * 网络撤防
     */
    public static final short PHONE_EVENT_DISARM_NET = 0x140d;

    /**
     * 网络布防
     */
    public static final short PHONE_EVENT_ARMING_NET = 0x340d;

    /**
     * 电话撤防
     */
    public static final short PHONE_EVENT_DISARM_TEL = 0x140c;

    /**
     * 电话布防
     */
    public static final short PHONE_EVENT_ARMING_TEL = 0x340c;

    /**
     * 周边撤防
     */
    public static final short PHONE_EVENT_DISARM_RIM = 0x140b;

    /**
     * 周边布防
     */
    public static final short PHONE_EVENT_ARMING_RIM = 0x340b;

    /**
     * 火灾报警
     */
    public static final short PHONE_EVENT_FIRE_ALARM = 0x1111;

    /**
     * 紧急报警
     */
    public static final short PHONE_EVENT_EMG_ALARM = 0x1120;

    /**
     * 报警
     */
    public static final short PHONE_EVENT_ALARM = 0x1130;

    /**
     * 家中无人活动
     */
    public static final short PHONE_EVENT_NO_ONE_HOME = 0x1162;

    /**
     * 传感器电池低压
     */
    public static final short PHONE_EVENT_VOLTAGE_SENSOR_LOW = 0x1384;

    /**
     * 设置改动
     */
    public static final short PHONE_EVENT_SET_CHANGE = 0x1306;

    /**
     * 无交流电
     */
    public static final short PHONE_EVENT_AC_NOT = 0x1301;

    /**
     * 电池电压低
     */
    public static final short PHONE_EVENT_VOLTAGE_BATTERY_LOW = 0x1302;

    /**
     * 系统启动
     */
    public static final short PHONE_EVENT_SYS_START = 0x1305;

}
